<?php
ini_set("error_reporting","E_ALL & ~E_NOTICE");
header("content-type:text/html; charset=utf8");//网页编码 gb2312 utf8
$url = $_GET["url"];
if($url == null or $url ==""){
    die("Url地址不能为空！");
}
$arr = file($url);
if($arr){
    foreach($arr as $a){
        if(strchr($a,"<title>")){
            $a = str_ireplace("<title>","",$a);
            $a = str_ireplace("</title>","",$a);
            //echo "<br><br><br><br>Title:标题：".$a."<br><br>";//标题
            $data["title"]=$a;
            break;
        }
    }
}
$meta_array = get_meta_tags($url);
//echo "keywords:关键词：".$meta_array["keywords"]."<br><br>";//关键词
//echo "description:描述：".$meta_array["description"]."<br><br>";//描述
$data["keywords"]=$meta_array["keywords"];
$data["description"]=$meta_array["description"];
if($data["description"] != null){
$data['status']="YES";
}else{
    $data['status']="NO";
    $data['msg']="读取失败了请重试！";
}
echo json_encode($data);
?>